package kr.co.handysoft.smartPolice.server;

import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Set;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

public final class ServerRegistry{

	/**
	 * 
	 */
	private static final long serialVersionUID = 7457959322350529442L;
	
	private static final Hashtable<String, JSONArray> internalConnectionInformation = new Hashtable<String, JSONArray>();

	public static int size() {
		return internalConnectionInformation.size();
	}

	public static boolean isEmpty() {
		return internalConnectionInformation.isEmpty();
	}

	public static Enumeration<String> keys() {
		return internalConnectionInformation.keys();
	}

	public static Enumeration<JSONArray> elements() {
		return internalConnectionInformation.elements();
	}

	public static boolean contains(JSONArray value) {
		return internalConnectionInformation.contains(value);
	}

	public static boolean containsValue(JSONObject value) {
		return internalConnectionInformation.containsValue(value);
	}

	public static boolean containsKey(String key) {
		return internalConnectionInformation.containsKey(key);
	}

	public static JSONArray get(String key) {
		return internalConnectionInformation.get(key);
	}

	public static Object put(String key, JSONObject value) {
		JSONArray infoArray = (JSONArray) internalConnectionInformation.get(key);
		if (infoArray == null){
			infoArray = new JSONArray();
			infoArray.add(value);
			internalConnectionInformation.put(key, infoArray);
		}else{
			infoArray.add(value);
		}
		return internalConnectionInformation.put(key, infoArray);
	}

	public static Object remove(Object key) {
		return internalConnectionInformation.remove(key);
	}

	public static void clear() {
		internalConnectionInformation.clear();
	}

	public static Set<String> keySet() {
		return internalConnectionInformation.keySet();
	}

}
